package com.jsonpfy.webservices;

import java.io.IOException;
import java.util.Map;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jsonpfy.operations.PutArray;

@SuppressWarnings("serial")
public class PutArrayServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {

		Map<String, String[]> parameters = request.getParameterMap();

		PutArray.doPut(parameters);

		String answer = Utilities.getCallback(request.getParameter("callback"),
				"OK");

		response.getWriter().println(answer);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws IOException {

		Map<String, String[]> parameters = request.getParameterMap();

		PutArray.doPut(parameters);

		String answer = Utilities.getCallback(request.getParameter("callback"),
				"OK");

		response.getWriter().println(answer);
	}
}
